<?php
    #-------------------------------------------------------------#
	# This file is part of the Kumomado - Virtual Window Platform #
	# for PHP. (c) 2009 Tsai, Min Che <tirme0812@gmail.com>       #
	# Please visit http://www.kumomado.org/ for more information. #
	#                                                             #
	# This software is licensed under the GNU License v3. Please  #
	# view the LICENSE file for the full text of this license.    #
    #-------------------------------------------------------------#

	Kumomado::load('MVCHelper.KumomadoMVCHelper');
	Kumomado::load('MVCHelper.Controller.KumomadoAbstractController');
	Kumomado::load('MVCHelper.Model.KumomadoAbstractModel');
	Kumomado::load('MVCHelper.View.KumomadoAbstractView');

	/**
	 *
	 * @package libraries/mvchelper/
	 * @author Tsai, Min Che
	 * @version 1.0
	 * @abstract
	 */
	abstract class KumomadoAbstractMVCHelper implements KumomadoMVCHelper {
		/**
		 * @var object
		 * @link KumomadoController
		 */
		protected $controller = null;
		/**
		 * @param object $controller @link KumomadoController
		 */
		public function init(KumomadoController $controller, KumomadoModel $model, KumomadoView $view) {
			$this->controller = $controller;
			$this->controller->setModel($model);
			$this->controller->setView($view);
		}
		/**
		 * @abstract
		 */
		abstract protected function loadModel();
		/**
		 * @abstract
		 */
		abstract protected function loadController();
		/**
		 * @abstract
		 */
		abstract protected function loadView();
		/**
		 * Execute the controller's method
		 */
		public function execute() {
			if (method_exists($this->controller, $this->method)) {
				$method = $this->method;
				$this->controller->beforeAction();
				$this->controller->$method($_POST);
				$this->controller->afterAction();
			}
		}
	}
?>